<?php
//声明一个类
class Person{
    public $name;
    public $gender;
    public function say(){
        echo $this->name.'is'.$this->gender;
    }
}
$student = new Person();
$student->name = '学生';
$student->gender = '男';
// print_r((array)$student);

// $teachher = new Person();
// $teachher->name = '老师';
// $teachher->gender = '女';
// $teachher->say();
// $student->say();


//将对象序列化之后存入文件中
// $str = serialize($student);
// echo $str;
// file_put_contents('store.txt',$str);


//在需要的时候,反序列化的取出这个对象
// $str = file_get_contents('store.txt');
// $studentArr = unserialize($str);
// var_dump($studentArr);
// $studentArr->say();



